package cn.qayy.service.impl;

import java.util.List;
import java.util.Map;
import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import cn.qayy.dao.UserMapper;
import cn.qayy.po.User;
import cn.qayy.service.IUserService;

@Service("userService")
public class UserServiceImpl implements IUserService {
    /*** 注入userMapper接口 该接口通过mybatis userMapper.xml配置实现**/
    @Resource
    private UserMapper userMapper;

    @Override
    public User loginUser(Map<String, Object> params) {
        User user = null;
        try {
            user = (User) userMapper.loginUser(params);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return user;
    }

    @Override
    public void updatePassword(Map<String, Object> params) {
        userMapper.updatePassword(params);
    }

    @Override
    public int insert(User user) {
        return userMapper.insert(user);
    }

    @Override
    public int insertSelective(User user) {
        return userMapper.insertSelective(user);
    }

    @Override
    public void insertAll(List<User> users) {
        userMapper.insertAll(users);
    }

    @Override
    public void deleteById(String id) {
        userMapper.deleteById(id);
    }

    @Override
    public void delete(User criteriaUser) {
        userMapper.delete(criteriaUser);
    }

    @Override
    public void deleteAll() {
        userMapper.deleteAll();
    }

    @Override
    public int updateByIdSelective(User record) {
        return userMapper.updateByIdSelective(record);
    }

    @Override
    public int updateById(User record) {
        return userMapper.updateById(record);
    }

    @Override
    public void update(User criteriaUser, User user) {
        userMapper.update(criteriaUser,user);
    }

    @Override
    public User selectById(Integer id) {
        return userMapper.selectById(id);
    }

    @Override
    public List<User> selectAll() {
        return userMapper.selectAll();
    }

    @Override
    public List<User> select(User criteriaUser, int skip, int limit) {
        return userMapper.select(criteriaUser,skip,limit);
    }

    @Override
    public User selectAndModify(User criteriaUser, User updateUser) {
        return userMapper.selectAndModify(criteriaUser,updateUser);
    }

    @Override
    public User selectAndRemove(User criteriaUser) {
        return userMapper.selectAndRemove(criteriaUser);
    }

    @Override
    public long count(User criteriaUser) {
        return userMapper.count(criteriaUser);
    }

    @Override
    public Integer isExistsFromBasicLib(Map<String, Object> user_name) {
        return userMapper.isExistsFromBasicLib(user_name);
    }
}
